<!doctype html>
<html lang="zh-CN">
<head>
  <base href="https://www.nodeapp.cn/errors.html" />
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>错误（Errors） | Node.js 中文文档 | Node.js 中文网</title>
  <meta name="description" content="Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境。Node.js 使用了一个事件驱动、非阻塞式 I/O 的模型，使其轻量又高效。Node.js 的包管理器 npm，是全球最大的开源库生态系统。">
  <link rel="stylesheet" href="assets/style.css">
  <link rel="stylesheet" href="assets/sh.css">
  <link rel="canonical" href="https://www.nodeapp.cn/errors.html">
  <link rel="apple-touch-icon" href="apple-touch-icon.png">
  <link rel="icon" sizes="32x32" type="image/png" href="favicon.png">
  
  <script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?acdf78480f7f8f2b23b812565a5868e0";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>

</head>
<body class="alt apidoc" id="api-section-errors">
  <div id="content" class="clearfix">
    <div id="column1" data-id="errors" class="interior">
      <header>
        <h1>Node.js v8.x 中文文档</h1>
        <hr>
      </header>

      <div id="toc">
        <h2>目录</h2>
        <ul>
<li><span class="stability_undefined"><a href="#errors_errors">Error (错误)</a></span><ul>
<li><span class="stability_undefined"><a href="#errors_error_propagation_and_interception">错误的冒泡和捕获</a></span><ul>
<li><span class="stability_undefined"><a href="#errors_error_first_callbacks">Error-first callbacks</a></span></li>
</ul>
</li>
<li><span class="stability_undefined"><a href="#errors_class_error">Error 类</a></span><ul>
<li><span class="stability_undefined"><a href="#errors_new_error_message">new Error(message)</a></span></li>
<li><span class="stability_undefined"><a href="#errors_error_capturestacktrace_targetobject_constructoropt">Error.captureStackTrace(targetObject[, constructorOpt])</a></span></li>
<li><span class="stability_undefined"><a href="#errors_error_stacktracelimit">Error.stackTraceLimit</a></span></li>
<li><span class="stability_undefined"><a href="#errors_error_code">error.code</a></span></li>
<li><span class="stability_undefined"><a href="#errors_error_message">error.message</a></span></li>
<li><span class="stability_undefined"><a href="#errors_error_stack">error.stack</a></span></li>
</ul>
</li>
<li><span class="stability_undefined"><a href="#errors_class_assertionerror">Class: AssertionError</a></span></li>
<li><span class="stability_undefined"><a href="#errors_class_rangeerror">RangeError 类</a></span></li>
<li><span class="stability_undefined"><a href="#errors_class_referenceerror">ReferenceError 类</a></span></li>
<li><span class="stability_undefined"><a href="#errors_class_syntaxerror">SyntaxError 类</a></span></li>
<li><span class="stability_undefined"><a href="#errors_class_typeerror">TypeError 类</a></span></li>
<li><span class="stability_undefined"><a href="#errors_exceptions_vs_errors">异常与错误</a></span></li>
<li><span class="stability_undefined"><a href="#errors_system_errors">系统错误</a></span><ul>
<li><span class="stability_undefined"><a href="#errors_class_system_error">系统错误类</a></span><ul>
<li><span class="stability_undefined"><a href="#errors_error_code_1">error.code</a></span></li>
<li><span class="stability_undefined"><a href="#errors_error_errno">error.errno</a></span></li>
<li><span class="stability_undefined"><a href="#errors_error_syscall">error.syscall</a></span></li>
<li><span class="stability_undefined"><a href="#errors_error_path">error.path</a></span></li>
<li><span class="stability_undefined"><a href="#errors_error_address">error.address</a></span></li>
<li><span class="stability_undefined"><a href="#errors_error_port">error.port</a></span></li>
</ul>
</li>
<li><span class="stability_undefined"><a href="#errors_common_system_errors">常见的系统错误</a></span></li>
</ul>
</li>
<li><span class="stability_undefined"><a href="#errors_node_js_error_codes">Node.js Error Codes</a></span><ul>
<li><span class="stability_undefined"><a href="#errors_err_arg_not_iterable">ERR_ARG_NOT_ITERABLE</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_async_callback">ERR_ASYNC_CALLBACK</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_async_type">ERR_ASYNC_TYPE</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_encoding_invalid_encoded_data">ERR_ENCODING_INVALID_ENCODED_DATA</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_encoding_not_supported">ERR_ENCODING_NOT_SUPPORTED</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_falsy_value_rejection">ERR_FALSY_VALUE_REJECTION</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http_headers_sent">ERR_HTTP_HEADERS_SENT</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http_invalid_char">ERR_HTTP_INVALID_CHAR</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http_invalid_status_code">ERR_HTTP_INVALID_STATUS_CODE</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http_trailer_invalid">ERR_HTTP_TRAILER_INVALID</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_connect_authority">ERR_HTTP2_CONNECT_AUTHORITY</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_connect_path">ERR_HTTP2_CONNECT_PATH</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_connect_scheme">ERR_HTTP2_CONNECT_SCHEME</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_frame_error">ERR_HTTP2_FRAME_ERROR</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_header_required">ERR_HTTP2_HEADER_REQUIRED</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_header_single_value">ERR_HTTP2_HEADER_SINGLE_VALUE</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_headers_after_respond">ERR_HTTP2_HEADERS_AFTER_RESPOND</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_headers_object">ERR_HTTP2_HEADERS_OBJECT</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_headers_sent">ERR_HTTP2_HEADERS_SENT</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_info_headers_after_respond">ERR_HTTP2_INFO_HEADERS_AFTER_RESPOND</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_info_status_not_allowed">ERR_HTTP2_INFO_STATUS_NOT_ALLOWED</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_invalid_connection_headers">ERR_HTTP2_INVALID_CONNECTION_HEADERS</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_invalid_header_value">ERR_HTTP2_INVALID_HEADER_VALUE</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_invalid_info_status">ERR_HTTP2_INVALID_INFO_STATUS</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_invalid_packed_settings_length">ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_invalid_pseudoheader">ERR_HTTP2_INVALID_PSEUDOHEADER</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_invalid_session">ERR_HTTP2_INVALID_SESSION</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_invalid_setting_value">ERR_HTTP2_INVALID_SETTING_VALUE</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_invalid_stream">ERR_HTTP2_INVALID_STREAM</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_max_pending_settings_ack">ERR_HTTP2_MAX_PENDING_SETTINGS_ACK</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_no_socket_manipulation">ERR_HTTP2_NO_SOCKET_MANIPULATION</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_out_of_streams">ERR_HTTP2_OUT_OF_STREAMS</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_payload_forbidden">ERR_HTTP2_PAYLOAD_FORBIDDEN</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_ping_cancel">ERR_HTTP2_PING_CANCEL</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_ping_length">ERR_HTTP2_PING_LENGTH</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_pseudoheader_not_allowed">ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_push_disabled">ERR_HTTP2_PUSH_DISABLED</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_send_file">ERR_HTTP2_SEND_FILE</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_socket_bound">ERR_HTTP2_SOCKET_BOUND</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_status_101">ERR_HTTP2_STATUS_101</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_status_invalid">ERR_HTTP2_STATUS_INVALID</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_stream_closed">ERR_HTTP2_STREAM_CLOSED</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_stream_error">ERR_HTTP2_STREAM_ERROR</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_stream_self_dependency">ERR_HTTP2_STREAM_SELF_DEPENDENCY</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_http2_unsupported_protocol">ERR_HTTP2_UNSUPPORTED_PROTOCOL</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_index_out_of_range">ERR_INDEX_OUT_OF_RANGE</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_invalid_arg_type">ERR_INVALID_ARG_TYPE</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_invalid_async_id">ERR_INVALID_ASYNC_ID</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_invalid_callback">ERR_INVALID_CALLBACK</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_invalid_file_url_host">ERR_INVALID_FILE_URL_HOST</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_invalid_file_url_path">ERR_INVALID_FILE_URL_PATH</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_invalid_handle_type">ERR_INVALID_HANDLE_TYPE</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_invalid_opt_value">ERR_INVALID_OPT_VALUE</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_invalid_performance_mark">ERR_INVALID_PERFORMANCE_MARK</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_invalid_protocol">ERR_INVALID_PROTOCOL</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_invalid_sync_fork_input">ERR_INVALID_SYNC_FORK_INPUT</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_invalid_this">ERR_INVALID_THIS</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_invalid_tuple">ERR_INVALID_TUPLE</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_invalid_url">ERR_INVALID_URL</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_invalid_url_scheme">ERR_INVALID_URL_SCHEME</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_ipc_channel_closed">ERR_IPC_CHANNEL_CLOSED</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_ipc_disconnected">ERR_IPC_DISCONNECTED</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_ipc_one_pipe">ERR_IPC_ONE_PIPE</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_ipc_sync_fork">ERR_IPC_SYNC_FORK</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_missing_args">ERR_MISSING_ARGS</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_napi_cons_function">ERR_NAPI_CONS_FUNCTION</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_napi_cons_prototype_object">ERR_NAPI_CONS_PROTOTYPE_OBJECT</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_no_icu">ERR_NO_ICU</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_outofmemory">ERR_OUTOFMEMORY</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_socket_already_bound">ERR_SOCKET_ALREADY_BOUND</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_socket_bad_port">ERR_SOCKET_BAD_PORT</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_socket_bad_type">ERR_SOCKET_BAD_TYPE</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_socket_cannot_send">ERR_SOCKET_CANNOT_SEND</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_socket_closed">ERR_SOCKET_CLOSED</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_socket_dgram_not_running">ERR_SOCKET_DGRAM_NOT_RUNNING</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_stderr_close">ERR_STDERR_CLOSE</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_stdout_close">ERR_STDOUT_CLOSE</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_tls_cert_altname_invalid">ERR_TLS_CERT_ALTNAME_INVALID</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_tls_dh_param_size">ERR_TLS_DH_PARAM_SIZE</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_tls_handshake_timeout">ERR_TLS_HANDSHAKE_TIMEOUT</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_tls_renegotiation_failed">ERR_TLS_RENEGOTIATION_FAILED</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_tls_required_server_name">ERR_TLS_REQUIRED_SERVER_NAME</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_tls_session_attack">ERR_TLS_SESSION_ATTACK</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_transform_already_transforming">ERR_TRANSFORM_ALREADY_TRANSFORMING</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_transform_with_length_0">ERR_TRANSFORM_WITH_LENGTH_0</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_unknown_signal">ERR_UNKNOWN_SIGNAL</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_unknown_stdin_type">ERR_UNKNOWN_STDIN_TYPE</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_unknown_stream_type">ERR_UNKNOWN_STREAM_TYPE</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_v8breakiterator">ERR_V8BREAKITERATOR</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_valid_performance_entry_type">ERR_VALID_PERFORMANCE_ENTRY_TYPE</a></span></li>
<li><span class="stability_undefined"><a href="#errors_err_value_out_of_range">ERR_VALUE_OUT_OF_RANGE</a></span></li>
</ul>
</li>
</ul>
</li>
</ul>

      </div>
<div id="apicontent">
        <h1>Error (错误)<span><a class="mark" href="#errors_errors" id="errors_errors">#</a></span></h1>
<!--introduced_in=v4.0.0-->
<!--type=misc-->
<p>Node.js 中运行的应用程序一般会遇到以下四类错误：</p>
<ul>
<li>标准的 JavaScript 错误：<ul>
<li>
            <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/EvalError" class="type">&lt;EvalError&gt;</a> : 当调用 <code>eval()</code> 失败时抛出。</li>
<li>
            <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError" class="type">&lt;SyntaxError&gt;</a> : 当 JavaScript 语法错误时抛出。</li>
<li>
            <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError" class="type">&lt;RangeError&gt;</a> : 当值不在预期范围内时抛出。</li>
<li>
            <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ReferenceError" class="type">&lt;ReferenceError&gt;</a> : 当使用未定义的变量时抛出。</li>
<li>
            <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError" class="type">&lt;TypeError&gt;</a> : 当传入错误类型的参数时抛出。</li>
<li>
            <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/URIError" class="type">&lt;URIError&gt;</a> : 当全局的 URI 处理函数被误用时抛出。</li>
</ul>
</li>
<li>由底层操作系触发的系统错误，例如试图打开一个不存在的文件、试图通过一个已关闭的 socket 发送数据等。</li>
<li>由应用程序代码触发的用户自定义的错误。</li>
<li>断言错误是错误的一个特殊类别，每当 Node.js 检测到一个不应该发生的异常逻辑时触发。
这类错误通常由 <code>assert</code> 模块引起。</li>
</ul>
<p>所有由 Node.js 引起的 JavaScript 错误与系统错误都继承自或实例化自标准的 JavaScript 
            <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error" class="type">&lt;Error&gt;</a> 类，且保证至少提供类中的属性。</p>
<h2>错误的冒泡和捕获<span><a class="mark" href="#errors_error_propagation_and_interception" id="errors_error_propagation_and_interception">#</a></span></h2>
<!--type=misc-->
<p>Node.js 支持几种当应用程序运行时发生的错误的冒泡和处理的机制。
如何报告和处理这些错误完全取决于错误的类型和被调用的 API 的风格。</p>
<p>所有 JavaScript 错误都会被作为异常处理，异常会立即产生并使用标准的 JavaScript <code>throw</code> 机制抛出一个错误。
这些都是使用 JavaScript 语言提供的 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch"><code>try / catch</code> 语句</a>处理的。</p>
<pre><code class="lang-js">// 抛出一个 ReferenceError，因为 z 为 undefined
try {
  const m = 1;
  const n = m + z;
} catch (err) {
  // 在这里处理错误。
}
</code></pre>
<p>JavaScript 的 <code>throw</code> 机制的任何使用都会引起异常，异常必须使用 <code>try / catch</code> 处理，否则 Node.js 进程会立即退出。</p>
<p>除了少数例外，同步的 API（任何不接受 <code>callback</code> 函数的阻塞方法，例如 [<code>fs.readFileSync</code>]）会使用 <code>throw</code> 报告错误。</p>
<p>异步的 API 中发生的错误可能会以多种方式进行报告：</p>
<ul>
<li>大多数的异步方法都接受一个 <code>callback</code> 函数，该函数会接受一个 <code>Error</code> 对象传入作为第一个参数。
如果第一个参数不是 <code>null</code> 而是一个 <code>Error</code> 实例，则说明发生了错误，应该进行处理。</li>
</ul>
<!-- eslint-disable no-useless-return -->
<pre><code class="lang-js">  const fs = require(&apos;fs&apos;);
  fs.readFile(&apos;一个不存在的文件&apos;, (err, data) =&gt; {
    if (err) {
      console.error(&apos;读取文件出错！&apos;, err);
      return;
    }
    // 否则处理数据
  });
</code></pre>
<ul>
<li><p>当一个异步方法被一个 <code>EventEmitter</code> 对象调用时，错误会被分发到对象的 <code>&apos;error&apos;</code> 事件上。</p>
<pre><code class="lang-js">const net = require(&apos;net&apos;);
const connection = net.connect(&apos;localhost&apos;);

// 添加一个 &apos;error&apos; 事件句柄到一个流：
connection.on(&apos;error&apos;, (err) =&gt; {
  // 如果连接被服务器重置，或无法连接，或发生任何错误，则错误会被发送到这里。 
  console.error(err);
});

connection.pipe(process.stdout);
</code></pre>
</li>
<li><p>Node.js API 中有一小部分普通的异步方法仍可能使用 <code>throw</code> 机制抛出异常，且必须使用 <code>try / catch</code> 处理。
这些方法并没有一个完整的列表；请参阅各个方法的文档以确定所需的合适的错误处理机制。</p>
</li>
</ul>
<p><code>&apos;error&apos;</code> 事件机制的使用常见于<a href="stream.html">基于流</a>和<a href="events.html#events_class_eventemitter">基于事件触发器</a>的 API，它们本身就代表了一系列的异步操作（相对于要么成功要么失败的单一操作）。</p>
<p>对于所有的 <code>EventEmitter</code> 对象，如果没有提供一个 <code>&apos;error&apos;</code> 事件句柄，则错误会被抛出，并造成 Node.js 进程报告一个未处理的异常且随即崩溃，除非：
适当地使用 <a href="domain.html"><code>domain</code></a> 模块或已经注册了一个 [<code>process.on(&apos;uncaughtException&apos;)</code>] 事件的句柄。</p>
<pre><code class="lang-js">const EventEmitter = require(&apos;events&apos;);
const ee = new EventEmitter();

setImmediate(() =&gt; {
  // 这会使进程崩溃，因为还为添加 &apos;error&apos; 事件句柄。
  ee.emit(&apos;error&apos;, new Error(&apos;这会崩溃&apos;));
});
</code></pre>
<p>这种方式产生的错误无法使用 <code>try / catch</code> 截获，因为它们是在调用的代码已经退出后抛出的。</p>
<p>开发者必须查阅各个方法的文档以明确在错误发生时这些方法是如何冒泡的。</p>
<h3>Error-first callbacks<span><a class="mark" href="#errors_error_first_callbacks" id="errors_error_first_callbacks">#</a></span></h3>
<!--type=misc-->
<p>Most asynchronous methods exposed by the Node.js core API follow an idiomatic
pattern  referred to as an <em>error-first callback</em> (sometimes referred to as
a <em>Node.js style callback</em>). With this pattern, a callback function is passed
to the method as an argument. When the operation either completes or an error
is raised, the callback function is called with
the Error object (if any) passed as the first argument. If no error was
raised, the first argument will be passed as <code>null</code>.</p>
<pre><code class="lang-js">const fs = require(&apos;fs&apos;);

function errorFirstCallback(err, data) {
  if (err) {
    console.error(&apos;There was an error&apos;, err);
    return;
  }
  console.log(data);
}

fs.readFile(&apos;/some/file/that/does-not-exist&apos;, errorFirstCallback);
fs.readFile(&apos;/some/file/that/does-exist&apos;, errorFirstCallback);
</code></pre>
<p>The JavaScript <code>try / catch</code> mechanism <strong>cannot</strong> be used to intercept errors
generated by asynchronous APIs.  A common mistake for beginners is to try to
use <code>throw</code> inside an error-first callback:</p>
<pre><code class="lang-js">// THIS WILL NOT WORK:
const fs = require(&apos;fs&apos;);

try {
  fs.readFile(&apos;/some/file/that/does-not-exist&apos;, (err, data) =&gt; {
    // mistaken assumption: throwing here...
    if (err) {
      throw err;
    }
  });
} catch (err) {
  // This will not catch the throw!
  console.error(err);
}
</code></pre>
<p>This will not work because the callback function passed to <code>fs.readFile()</code> is
called asynchronously. By the time the callback has been called, the
surrounding code (including the <code>try { } catch (err) { }</code> block will have
already exited. Throwing an error inside the callback <strong>can crash the Node.js
process</strong> in most cases. If [domains][] are enabled, or a handler has been
registered with <code>process.on(&apos;uncaughtException&apos;)</code>, such errors can be
intercepted.</p>
<h2>Error 类<span><a class="mark" href="#errors_class_error" id="errors_class_error">#</a></span></h2>
<!--type=class-->
<p>一个通用的 JavaScript <code>Error</code> 对象，它不表示错误发生的具体情况。
<code>Error</code> 对象会捕捉一个“堆栈跟踪”，详细说明被实例化的 <code>Error</code> 对象在代码中的位置，并可能提供错误的文字描述。</p>
<p>只对于加密，如果在抛出错误时可以使用 <code>Error</code> 对象，则会将OpenSSL错误堆栈放入到名为 <code>opensslErrorStack</code> 的单独属性中。</p>
<p>所有由 Node.js 产生的错误，包括所有系统的和 JavaScript 的错误都实例化自或继承自 <code>Error</code> 类。</p>
<h3>new Error(message)<span><a class="mark" href="#errors_new_error_message" id="errors_new_error_message">#</a></span></h3>
<div class="signature"><ul>
<li><code>message</code> 
            <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&lt;string&gt;</a></li>
</ul>
</div><p>新建一个 <code>Error</code> 实例，并设置 <code>error.message</code> 属性以提供文本信息。
如果 <code>message</code> 传的是一个对象，则会调用 <code>message.toString()</code> 生成文本信息。
<code>error.stack</code> 属性表示被调用的 <code>new Error()</code> 在代码中的位置。
堆栈跟踪是基于 <a href="https://github.com/v8/v8/wiki/Stack-Trace-API">V8 的堆栈跟踪 API</a> 的。
堆栈跟踪只会取（a）异步代码执行的开头或（b）<code>Error.stackTraceLimit</code> 属性给出的栈帧中的最小项。</p>
<h3>Error.captureStackTrace(targetObject[, constructorOpt])<span><a class="mark" href="#errors_error_capturestacktrace_targetobject_constructoropt" id="errors_error_capturestacktrace_targetobject_constructoropt">#</a></span></h3>
<div class="signature"><ul>
<li><code>targetObject</code> 
            <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&lt;Object&gt;</a></li>
<li><code>constructorOpt</code> 
            <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function" class="type">&lt;Function&gt;</a></li>
</ul>
</div><p>在 <code>targetObject</code> 上创建一个 <code>.stack</code> 属性，当访问时返回一个表示代码中调用 <code>Error.captureStackTrace()</code> 的位置的字符串。</p>
<pre><code class="lang-js">const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // 类似 `new Error().stack`
</code></pre>
<p><code>${myObject.name}: ${myObject.message}</code> 会作为该堆栈跟踪的第一行。</p>
<p>可选的 <code>constructorOpt</code> 参数接受一个函数。
如果提供了，则 <code>constructorOpt</code> 之上包括自身在内的全部栈帧都会被生成的堆栈跟踪省略。</p>
<p><code>constructorOpt</code> 参数用在向最终用户隐藏错误生成的具体细节时非常有用。例如：</p>
<pre><code class="lang-js">function MyError() {
  Error.captureStackTrace(this, MyError);
}

// 没传入 MyError 到 captureStackTrace，MyError 帧会显示在 .stack 属性。
// 通过传入构造函数，可以省略该帧，且保留其下面的所有帧。
new MyError().stack;
</code></pre>
<h3>Error.stackTraceLimit<span><a class="mark" href="#errors_error_stacktracelimit" id="errors_error_stacktracelimit">#</a></span></h3>
<div class="signature"><ul>
<li>
            <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a></li>
</ul>
</div><p><code>Error.stackTraceLimit</code> 属性指定了堆栈跟踪收集的栈帧数量（无论是 <code>new Error().stack</code> 或 <code>Error.captureStackTrace(obj)</code> 产生的）。</p>
<p>默认值为 <code>10</code> ，但可设为任何有效的 JavaScript 数值。
值改变后的变化会影响所有捕获到的堆栈跟踪。</p>
<p>如果设为一个非数值或负数，则堆栈跟踪不会捕捉任何栈帧。</p>
<h3>error.code<span><a class="mark" href="#errors_error_code" id="errors_error_code">#</a></span></h3>
<div class="signature"><ul>
<li>
            <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&lt;string&gt;</a></li>
</ul>
</div><p><code>error.code</code> 属性是标识错误类别的字符标签。详见 [Node.js Error Codes][] 关于特定的错误码</p>
<h3>error.message<span><a class="mark" href="#errors_error_message" id="errors_error_message">#</a></span></h3>
<div class="signature"><ul>
<li>
            <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&lt;string&gt;</a></li>
</ul>
</div><p><code>error.message</code> 属性是错误的字符串描述，通过调用 <code>new Error(message)</code> 设置。
传给构造函数的 <code>message</code> 也会出现在 <code>Error</code> 的堆栈跟踪的第一行。
但是，<code>Error</code> 对象创建后改变这个属性可能不会改变堆栈跟踪的第一行（比如当 <code>error.stack</code> 在该属性被改变之前被读取）。</p>
<pre><code class="lang-js">const err = new Error(&apos;错误信息&apos;);
console.error(err.message);
// 打印: 错误信息
</code></pre>
<h3>error.stack<span><a class="mark" href="#errors_error_stack" id="errors_error_stack">#</a></span></h3>
<div class="signature"><ul>
<li>
            <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&lt;string&gt;</a></li>
</ul>
</div><p><code>error.stack</code> 属性是一个字符串，描述代码中 <code>Error</code> 被实例化的位置。</p>
<p>例子：</p>
<pre><code class="lang-txt">Error: Things keep happening!
   at /home/gbusey/file.js:525:2
   at Frobnicator.refrobulate (/home/gbusey/business-logic.js:424:21)
   at Actor.&lt;anonymous&gt; (/home/gbusey/actors.js:400:8)
   at increaseSynergy (/home/gbusey/actors.js:701:6)
</code></pre>
<p>第一行会被格式化为 <code>&lt;error class name&gt;: &lt;error message&gt;</code>，且带上一系列栈帧（每一行都以 &quot;at &quot; 开头）。
每一帧描述了一个代码中导致错误生成的调用点。
V8 引擎会试图显示每个函数的名称（变量名、函数名、或对象的方法名），但偶尔也可能找不到一个合适的名称。
如果 V8 引擎没法确定一个函数的名称，则只显示帧的位置信息。
否则，在位置信息的旁边会显示明确的函数名。</p>
<p>帧只由 JavaScript 函数产生。
例如，同步地执行一个名为 <code>cheetahify</code> 的 C++ 插件，且插件自身调用一个 JavaScript 函数，代表 <code>cheetahify</code> 回调的栈帧不会出现在堆栈跟踪里：</p>
<pre><code class="lang-js">const cheetahify = require(&apos;./native-binding.node&apos;);

function makeFaster() {
  // cheetahify 同步地调用 speedy.
  cheetahify(function speedy() {
    throw new Error(&apos;oh no!&apos;);
  });
}

makeFaster();
// will throw:
//   /home/gbusey/file.js:6
//       throw new Error(&apos;oh no!&apos;);
//           ^
//   Error: oh no!
//       at speedy (/home/gbusey/file.js:6:11)
//       at makeFaster (/home/gbusey/file.js:5:3)
//       at Object.&lt;anonymous&gt; (/home/gbusey/file.js:10:1)
//       at Module._compile (module.js:456:26)
//       at Object.Module._extensions..js (module.js:474:10)
//       at Module.load (module.js:356:32)
//       at Function.Module._load (module.js:312:12)
//       at Function.Module.runMain (module.js:497:10)
//       at startup (node.js:119:16)
//       at node.js:906:3
</code></pre>
<p>位置信息会是其中之一：</p>
<ul>
<li><code>native</code>，帧表示一个 V8 引擎内部的调用（比如，<code>[].forEach</code>）。</li>
<li><code>plain-filename.js:line:column</code>，帧表示一个 Node.js 内部的调用。</li>
<li><code>/absolute/path/to/file.js:line:column</code>，帧表示一个用户程序或其依赖的调用。</li>
</ul>
<p>代表堆栈跟踪的字符串是在 <code>error.stack</code> 属性被访问时才生成的。</p>
<p>堆栈跟踪捕获的帧的数量是由 <code>Error.stackTraceLimit</code> 或当前事件循环中可用的帧数量的最小值界定的。</p>
<p>系统级的错误是由扩展的 <code>Error</code> 实例产生的，详见<a href="#errors_system_errors">系统错误</a>。</p>
<h2>Class: AssertionError<span><a class="mark" href="#errors_class_assertionerror" id="errors_class_assertionerror">#</a></span></h2>
<p><code>Error</code> 的子类，表示断言失败。 这种错误通常表示实际值和预期值不相等。</p>
<p>比如:</p>
<pre><code class="lang-js">assert.strictEqual(1, 2);
// AssertionError [ERR_ASSERTION]: 1 === 2
</code></pre>
<h2>RangeError 类<span><a class="mark" href="#errors_class_rangeerror" id="errors_class_rangeerror">#</a></span></h2>
<p><code>Error</code> 的一个子类，表明一个函数的一个给定的参数的值不在可接受的集合或范围内；
无论是一个数字范围还是给定函数参数的选项的集合。</p>
<p>例子：</p>
<pre><code class="lang-js">require(&apos;net&apos;).connect(-1);
// 抛出 &quot;RangeError: &quot;port&quot; option should be &gt;= 0 and &lt; 65536: -1&quot;
</code></pre>
<p>Node.js 会生成并以参数校验的形式立即抛出 <code>RangeError</code> 实例。</p>
<h2>ReferenceError 类<span><a class="mark" href="#errors_class_referenceerror" id="errors_class_referenceerror">#</a></span></h2>
<p><code>Error</code> 的一个子类，表明试图访问一个未定义的变量。
这些错误通常表明代码有拼写错误或程序已损坏。</p>
<p>虽然客户端代码可能产生和传播这些错误，但在实践中，只有 V8 引擎会这么做。</p>
<pre><code class="lang-js">doesNotExist;
// 抛出 ReferenceError，在这个程序中 doesNotExist 不是一个变量。
</code></pre>
<p>除非应用程序是动态生成并运行的代码，否则 <code>ReferenceError</code> 实例应该始终被视为代码中或其依赖中的错误。</p>
<h2>SyntaxError 类<span><a class="mark" href="#errors_class_syntaxerror" id="errors_class_syntaxerror">#</a></span></h2>
<p><code>Error</code> 的一个子类，表明程序不是有效的 JavaScript 代码。
这些错误是代码执行的结果产生和传播的。
代码执行可能产生自 <code>eval</code>、<code>Function</code>、<code>require</code> 或 [vm]。
这些错误几乎都表明程序已损坏。</p>
<pre><code class="lang-js">try {
  require(&apos;vm&apos;).runInThisContext(&apos;binary ! isNotOk&apos;);
} catch (err) {
  // err 是一个 SyntaxError
}
</code></pre>
<p><code>SyntaxError</code> 实例在创建它们的上下文中是不可恢复的。
它们只可被其他上下文捕获。</p>
<h2>TypeError 类<span><a class="mark" href="#errors_class_typeerror" id="errors_class_typeerror">#</a></span></h2>
<p><code>Error</code> 的一个子类，表明提供的参数不是一个被允许的类型。
例如，将一个函数传给一个期望字符串的参数会被视为一个 <code>TypeError</code>。</p>
<pre><code class="lang-js">require(&apos;url&apos;).parse(() =&gt; { });
// 抛出 TypeError，因为它期望的是一个字符串
</code></pre>
<p>Node.js 会生成并以参数校验的形式立即抛出 <code>TypeError</code> 实例。</p>
<h2>异常与错误<span><a class="mark" href="#errors_exceptions_vs_errors" id="errors_exceptions_vs_errors">#</a></span></h2>
<!--type=misc-->
<p>JavaScript 异常是一个作为一个无效操作的结果或作为一个 <code>throw</code> 声明的目标所抛出的值。
虽然它不要求这些值是 <code>Error</code> 的实例或继承自 <code>Error</code> 的类的实例，但所有通过 Node.js 或 JavaScript 运行时抛出的异常都是 <code>Error</code> 实例。</p>
<p>有些异常在 JavaScript 层是无法恢复的。
这些异常总会引起 Node.js 进程的崩溃。
例如 <code>assert()</code> 检测或在 C++ 层调用的 <code>abort()</code>。</p>
<h2>系统错误<span><a class="mark" href="#errors_system_errors" id="errors_system_errors">#</a></span></h2>
<p>系统错误是当程序运行环境中发生异常时产生的。
特别是，当应用程序违反了操作系统的限制时发生的操作错误，例如试图读取一个不存在的文件或用户没有足够的权限。</p>
<p>系统错误通常产生于系统调用层级。
在大多数 Unix 系统上，可通过运行 <code>man 2 intro</code>、<code>man 3 errno</code>、或<a href="http://man7.org/linux/man-pages/man3/errno.3.html">在线文档</a>获取错误代码的详细清单和含义。</p>
<p>系统错误是由扩展的 <code>Error</code> 对象加上附加属性表现的。</p>
<h3>系统错误类<span><a class="mark" href="#errors_class_system_error" id="errors_class_system_error">#</a></span></h3>
<h4>error.code<span><a class="mark" href="#errors_error_code_1" id="errors_error_code_1">#</a></span></h4>
<div class="signature"><ul>
<li>
            <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&lt;String&gt;</a></li>
</ul>
</div><p><code>error.code</code> 属性是一个表示错误码的字符串，总是 <code>E</code> 带上一串大写字母。</p>
<h4>error.errno<span><a class="mark" href="#errors_error_errno" id="errors_error_errno">#</a></span></h4>
<div class="signature"><ul>
<li>
            <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&lt;string&gt;</a> | 
            <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a></li>
</ul>
</div><p><code>error.errno</code> 属性是一个数值或字符串。
如果返回一个数值，则数值是一个负数，对应 <a href="http://docs.libuv.org/en/v1.x/errors.html"><code>libuv 错误处理</code></a> 中定义的错误码。
详见 uv-errno.h 头文件（Node.js 源代码中的 <code>deps/uv/include/uv-errno.h</code>）。
如果返回一个字符串，则同 <code>error.code</code>。</p>
<h4>error.syscall<span><a class="mark" href="#errors_error_syscall" id="errors_error_syscall">#</a></span></h4>
<div class="signature"><ul>
<li>
            <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&lt;string&gt;</a></li>
</ul>
</div><p><code>error.syscall</code> 属性是一个字符串，描述失败的 <a href="http://man7.org/linux/man-pages/man2/syscall.2.html">系统调用</a>。</p>
<h4>error.path<span><a class="mark" href="#errors_error_path" id="errors_error_path">#</a></span></h4>
<div class="signature"><ul>
<li>
            <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&lt;string&gt;</a></li>
</ul>
</div><p>错误出现时 (比如 在 <code>fs</code> 或 <code>child_process</code>), <code>error.path</code>属性是一个字符串，包含了相关不可用路径名。</p>
<h4>error.address<span><a class="mark" href="#errors_error_address" id="errors_error_address">#</a></span></h4>
<div class="signature"><ul>
<li>
            <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&lt;string&gt;</a></li>
</ul>
</div><p>错误出现时 (比如 在 <code>net</code> 或 <code>dgram</code>), <code>error.address</code> 属性是对链接失败的地址的描述。</p>
<h4>error.port<span><a class="mark" href="#errors_error_port" id="errors_error_port">#</a></span></h4>
<div class="signature"><ul>
<li>
            <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a></li>
</ul>
</div><p>错误出现时 (比如 在 <code>net</code> 或 <code>dgram</code>), <code>error.port</code>是一个链接端口不可用的端口值</p>
<h3>常见的系统错误<span><a class="mark" href="#errors_common_system_errors" id="errors_common_system_errors">#</a></span></h3>
<p>以下列表是不完整的，但列举了编写 Node.js 程序时会遇到的一些常见的系统错误。
详细的列表可从 <a href="http://man7.org/linux/man-pages/man3/errno.3.html">ERRNO 文档</a>找到。</p>
<ul>
<li><p><code>EACCES</code> (拒绝访问): 试图以被一个文件的访问权限禁止的方式访问一个文件。</p>
</li>
<li><p><code>EADDRINUSE</code> (地址已被使用):  试图绑定一个服务器（[<code>net</code>]、[<code>http</code>] 或 [<code>https</code>]）到本地地址，但因另一个本地系统的服务器已占用了该地址而导致失败。</p>
</li>
<li><p><code>ECONNREFUSED</code> (连接被拒绝): 无法连接，因为目标机器积极拒绝。
这通常是因为试图连接到外部主机上的废弃的服务。</p>
</li>
<li><p><code>ECONNRESET</code> (连接被重置): 一个连接被强行关闭。
这通常是因为连接到远程 socket 超时或重启。
常发生于 [<code>http</code>] 和 [<code>net</code>] 模块。</p>
</li>
<li><p><code>EEXIST</code> (文件已存在): 一个操作的目标文件已存在，而要求目标不存在。</p>
</li>
<li><p><code>EISDIR</code> (是一个目录): 一个操作要求一个文件，但给定的路径是一个目录。</p>
</li>
<li><p><code>EMFILE</code> (系统打开了太多文件): 已达到系统<a href="https://en.wikipedia.org/wiki/File_descriptor">文件描述符</a>允许的最大数量，且描述符的请求不能被满足直到至少关闭其中一个。
当一次并行打开多个文件时会发生这个错误，尤其是在进程的文件描述限制数量较低的操作系统（如 macOS）。
要解决这个限制，可在运行 Node.js 进程的同一 shell 中运行 <code>ulimit -n 2048</code>。</p>
</li>
<li><p><code>ENOENT</code> (无此文件或目录): 通常是由 [<code>fs</code>] 操作引起的，表明指定的路径不存在，即给定的路径找不到文件或目录。</p>
</li>
<li><p><code>ENOTDIR</code> (不是一个目录): 给定的路径虽然存在，但不是一个目录。
通常是由 [<code>fs.readdir</code>] 引起的。</p>
</li>
<li><p><code>ENOTEMPTY</code> (目录非空): 一个操作的目标是一个非空的目录，而要求的是一个空目录。
通常是由 [<code>fs.unlink</code>] 引起的。</p>
</li>
<li><p><code>EPERM</code> (操作不被允许): 试图执行一个需要更高权限的操作。</p>
</li>
<li><p><code>EPIPE</code> (管道损坏): 写入一个管道、socket 或 FIFO 时没有进程读取数据。
常见于 [<code>net</code>] 和 [<code>http</code>] 层，表明远端要写入的流已被关闭。</p>
</li>
<li><p><code>ETIMEDOUT</code> (操作超时): 一个连接或发送的请求失败，因为连接方在一段时间后没有做出合适的响应。
常见于 [<code>http</code>] 或 [<code>net</code>]。
往往标志着 <code>socket.end()</code> 没有被正确地调用。</p>
</li>
</ul>
<p><a id="nodejs-error-codes"></a></p>
<h2>Node.js Error Codes<span><a class="mark" href="#errors_node_js_error_codes" id="errors_node_js_error_codes">#</a></span></h2>
<p><a id="ERR_ARG_NOT_ITERABLE"></a></p>
<h3>ERR_ARG_NOT_ITERABLE<span><a class="mark" href="#errors_err_arg_not_iterable" id="errors_err_arg_not_iterable">#</a></span><span><a class="mark" href="#ERR_ARG_NOT_ITERABLE" id="ERR_ARG_NOT_ITERABLE">#</a></span></h3>
<p>需要可遍历的参数（也就是可使用 <code>for...of</code> 遍历的值）。</p>
<p><a id="ERR_ASYNC_CALLBACK"></a></p>
<h3>ERR_ASYNC_CALLBACK<span><a class="mark" href="#errors_err_async_callback" id="errors_err_async_callback">#</a></span><span><a class="mark" href="#ERR_ASYNC_CALLBACK" id="ERR_ASYNC_CALLBACK">#</a></span></h3>
<p>试图注册不是 <code>AsyncHooks</code> 回调的函数。</p>
<p><a id="ERR_ASYNC_TYPE"></a></p>
<h3>ERR_ASYNC_TYPE<span><a class="mark" href="#errors_err_async_type" id="errors_err_async_type">#</a></span><span><a class="mark" href="#ERR_ASYNC_TYPE" id="ERR_ASYNC_TYPE">#</a></span></h3>
<p>异步资源的类型不合法。
如果使用公共嵌入的 API，则用户可以定义自己的类型。</p>
<p><a id="ERR_ENCODING_INVALID_ENCODED_DATA"></a></p>
<h3>ERR_ENCODING_INVALID_ENCODED_DATA<span><a class="mark" href="#errors_err_encoding_invalid_encoded_data" id="errors_err_encoding_invalid_encoded_data">#</a></span><span><a class="mark" href="#ERR_ENCODING_INVALID_ENCODED_DATA" id="ERR_ENCODING_INVALID_ENCODED_DATA">#</a></span></h3>
<p>提供给 <code>util.TextDecoder()</code> API 的数据不符合指定的编码。</p>
<p><a id="ERR_ENCODING_NOT_SUPPORTED"></a></p>
<h3>ERR_ENCODING_NOT_SUPPORTED<span><a class="mark" href="#errors_err_encoding_not_supported" id="errors_err_encoding_not_supported">#</a></span><span><a class="mark" href="#ERR_ENCODING_NOT_SUPPORTED" id="ERR_ENCODING_NOT_SUPPORTED">#</a></span></h3>
<p>提供给 <code>util.TextDecoder()</code> API 的字符编码不是<a href="util.md#whatwg-supported-encodings">WHATWG支持的字符编码</a>。</p>
<p><a id="ERR_FALSY_VALUE_REJECTION"></a></p>
<h3>ERR_FALSY_VALUE_REJECTION<span><a class="mark" href="#errors_err_falsy_value_rejection" id="errors_err_falsy_value_rejection">#</a></span><span><a class="mark" href="#ERR_FALSY_VALUE_REJECTION" id="ERR_FALSY_VALUE_REJECTION">#</a></span></h3>
<p>A <code>Promise</code> that was callbackified via <code>util.callbackify()</code> was rejected with a
falsy value.</p>
<p><a id="ERR_HTTP_HEADERS_SENT"></a></p>
<h3>ERR_HTTP_HEADERS_SENT<span><a class="mark" href="#errors_err_http_headers_sent" id="errors_err_http_headers_sent">#</a></span><span><a class="mark" href="#ERR_HTTP_HEADERS_SENT" id="ERR_HTTP_HEADERS_SENT">#</a></span></h3>
<p>当消息头已发送后，还试图添加消息头。</p>
<p><a id="ERR_HTTP_INVALID_CHAR"></a></p>
<h3>ERR_HTTP_INVALID_CHAR<span><a class="mark" href="#errors_err_http_invalid_char" id="errors_err_http_invalid_char">#</a></span><span><a class="mark" href="#ERR_HTTP_INVALID_CHAR" id="ERR_HTTP_INVALID_CHAR">#</a></span></h3>
<p>HTTP 响应的状态信息中存在非法字符。</p>
<p><a id="ERR_HTTP_INVALID_STATUS_CODE"></a></p>
<h3>ERR_HTTP_INVALID_STATUS_CODE<span><a class="mark" href="#errors_err_http_invalid_status_code" id="errors_err_http_invalid_status_code">#</a></span><span><a class="mark" href="#ERR_HTTP_INVALID_STATUS_CODE" id="ERR_HTTP_INVALID_STATUS_CODE">#</a></span></h3>
<p>状态码超出正常范围（100-999）。</p>
<p><a id="ERR_HTTP_TRAILER_INVALID"></a></p>
<h3>ERR_HTTP_TRAILER_INVALID<span><a class="mark" href="#errors_err_http_trailer_invalid" id="errors_err_http_trailer_invalid">#</a></span><span><a class="mark" href="#ERR_HTTP_TRAILER_INVALID" id="ERR_HTTP_TRAILER_INVALID">#</a></span></h3>
<p>The <code>Trailer</code> header was set even though the transfer encoding does not support that.</p>
<p><a id="ERR_HTTP2_CONNECT_AUTHORITY"></a></p>
<h3>ERR_HTTP2_CONNECT_AUTHORITY<span><a class="mark" href="#errors_err_http2_connect_authority" id="errors_err_http2_connect_authority">#</a></span><span><a class="mark" href="#ERR_HTTP2_CONNECT_AUTHORITY" id="ERR_HTTP2_CONNECT_AUTHORITY">#</a></span></h3>
<p>For HTTP/2 requests using the <code>CONNECT</code> method, the <code>:authority</code> pseudo-header
is required.</p>
<p><a id="ERR_HTTP2_CONNECT_PATH"></a></p>
<h3>ERR_HTTP2_CONNECT_PATH<span><a class="mark" href="#errors_err_http2_connect_path" id="errors_err_http2_connect_path">#</a></span><span><a class="mark" href="#ERR_HTTP2_CONNECT_PATH" id="ERR_HTTP2_CONNECT_PATH">#</a></span></h3>
<p>通过<code>CONNECT</code>方法发送的HTTP/2请求时，<code>:path</code> 伪header 被禁用</p>
<p><a id="ERR_HTTP2_CONNECT_SCHEME"></a></p>
<h3>ERR_HTTP2_CONNECT_SCHEME<span><a class="mark" href="#errors_err_http2_connect_scheme" id="errors_err_http2_connect_scheme">#</a></span><span><a class="mark" href="#ERR_HTTP2_CONNECT_SCHEME" id="ERR_HTTP2_CONNECT_SCHEME">#</a></span></h3>
<p>通过<code>CONNECT</code>方法发送HTTP/2请求时，<code>:scheme</code>伪header 被禁用。</p>
<p><a id="ERR_HTTP2_FRAME_ERROR"></a></p>
<h3>ERR_HTTP2_FRAME_ERROR<span><a class="mark" href="#errors_err_http2_frame_error" id="errors_err_http2_frame_error">#</a></span><span><a class="mark" href="#ERR_HTTP2_FRAME_ERROR" id="ERR_HTTP2_FRAME_ERROR">#</a></span></h3>
<p>通过 HTTP/2 会话发送单个数据帧失败。</p>
<p><a id="ERR_HTTP2_HEADER_REQUIRED"></a></p>
<h3>ERR_HTTP2_HEADER_REQUIRED<span><a class="mark" href="#errors_err_http2_header_required" id="errors_err_http2_header_required">#</a></span><span><a class="mark" href="#ERR_HTTP2_HEADER_REQUIRED" id="ERR_HTTP2_HEADER_REQUIRED">#</a></span></h3>
<p>HTTP/2 消息缺少必需的消息头。</p>
<p><a id="ERR_HTTP2_HEADER_SINGLE_VALUE"></a></p>
<h3>ERR_HTTP2_HEADER_SINGLE_VALUE<span><a class="mark" href="#errors_err_http2_header_single_value" id="errors_err_http2_header_single_value">#</a></span><span><a class="mark" href="#ERR_HTTP2_HEADER_SINGLE_VALUE" id="ERR_HTTP2_HEADER_SINGLE_VALUE">#</a></span></h3>
<p>为只需一个值的 HTTP/2 消息头提供了多个值。</p>
<p><a id="ERR_HTTP2_HEADERS_AFTER_RESPOND"></a></p>
<h3>ERR_HTTP2_HEADERS_AFTER_RESPOND<span><a class="mark" href="#errors_err_http2_headers_after_respond" id="errors_err_http2_headers_after_respond">#</a></span><span><a class="mark" href="#ERR_HTTP2_HEADERS_AFTER_RESPOND" id="ERR_HTTP2_HEADERS_AFTER_RESPOND">#</a></span></h3>
<p>An additional headers was specified after an HTTP/2 response was initiated.</p>
<p><a id="ERR_HTTP2_HEADERS_OBJECT"></a></p>
<h3>ERR_HTTP2_HEADERS_OBJECT<span><a class="mark" href="#errors_err_http2_headers_object" id="errors_err_http2_headers_object">#</a></span><span><a class="mark" href="#ERR_HTTP2_HEADERS_OBJECT" id="ERR_HTTP2_HEADERS_OBJECT">#</a></span></h3>
<p>An HTTP/2 Headers Object was expected.</p>
<p><a id="ERR_HTTP2_HEADERS_SENT"></a></p>
<h3>ERR_HTTP2_HEADERS_SENT<span><a class="mark" href="#errors_err_http2_headers_sent" id="errors_err_http2_headers_sent">#</a></span><span><a class="mark" href="#ERR_HTTP2_HEADERS_SENT" id="ERR_HTTP2_HEADERS_SENT">#</a></span></h3>
<p>An attempt was made to send multiple response headers.</p>
<p><a id="ERR_HTTP2_INFO_HEADERS_AFTER_RESPOND"></a></p>
<h3>ERR_HTTP2_INFO_HEADERS_AFTER_RESPOND<span><a class="mark" href="#errors_err_http2_info_headers_after_respond" id="errors_err_http2_info_headers_after_respond">#</a></span><span><a class="mark" href="#ERR_HTTP2_INFO_HEADERS_AFTER_RESPOND" id="ERR_HTTP2_INFO_HEADERS_AFTER_RESPOND">#</a></span></h3>
<p>HTTP/2 Informational headers must only be sent <em>prior</em> to calling the
<code>Http2Stream.prototype.respond()</code> method.</p>
<p><a id="ERR_HTTP2_INFO_STATUS_NOT_ALLOWED"></a></p>
<h3>ERR_HTTP2_INFO_STATUS_NOT_ALLOWED<span><a class="mark" href="#errors_err_http2_info_status_not_allowed" id="errors_err_http2_info_status_not_allowed">#</a></span><span><a class="mark" href="#ERR_HTTP2_INFO_STATUS_NOT_ALLOWED" id="ERR_HTTP2_INFO_STATUS_NOT_ALLOWED">#</a></span></h3>
<p>Informational HTTP status codes (<code>1xx</code>) may not be set as the response status
code on HTTP/2 responses.</p>
<p><a id="ERR_HTTP2_INVALID_CONNECTION_HEADERS"></a></p>
<h3>ERR_HTTP2_INVALID_CONNECTION_HEADERS<span><a class="mark" href="#errors_err_http2_invalid_connection_headers" id="errors_err_http2_invalid_connection_headers">#</a></span><span><a class="mark" href="#ERR_HTTP2_INVALID_CONNECTION_HEADERS" id="ERR_HTTP2_INVALID_CONNECTION_HEADERS">#</a></span></h3>
<p>HTTP/1 connection specific headers are forbidden to be used in HTTP/2
requests and responses.</p>
<p><a id="ERR_HTTP2_INVALID_HEADER_VALUE"></a></p>
<h3>ERR_HTTP2_INVALID_HEADER_VALUE<span><a class="mark" href="#errors_err_http2_invalid_header_value" id="errors_err_http2_invalid_header_value">#</a></span><span><a class="mark" href="#ERR_HTTP2_INVALID_HEADER_VALUE" id="ERR_HTTP2_INVALID_HEADER_VALUE">#</a></span></h3>
<p>An invalid HTTP/2 header value was specified.</p>
<p><a id="ERR_HTTP2_INVALID_INFO_STATUS"></a></p>
<h3>ERR_HTTP2_INVALID_INFO_STATUS<span><a class="mark" href="#errors_err_http2_invalid_info_status" id="errors_err_http2_invalid_info_status">#</a></span><span><a class="mark" href="#ERR_HTTP2_INVALID_INFO_STATUS" id="ERR_HTTP2_INVALID_INFO_STATUS">#</a></span></h3>
<p>An invalid HTTP informational status code has been specified. Informational
status codes must be an integer between <code>100</code> and <code>199</code> (inclusive).</p>
<p><a id="ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH"></a></p>
<h3>ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH<span><a class="mark" href="#errors_err_http2_invalid_packed_settings_length" id="errors_err_http2_invalid_packed_settings_length">#</a></span><span><a class="mark" href="#ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH" id="ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH">#</a></span></h3>
<p>Input <code>Buffer</code> and <code>Uint8Array</code> instances passed to the
<code>http2.getUnpackedSettings()</code> API must have a length that is a multiple of
six.</p>
<p><a id="ERR_HTTP2_INVALID_PSEUDOHEADER"></a></p>
<h3>ERR_HTTP2_INVALID_PSEUDOHEADER<span><a class="mark" href="#errors_err_http2_invalid_pseudoheader" id="errors_err_http2_invalid_pseudoheader">#</a></span><span><a class="mark" href="#ERR_HTTP2_INVALID_PSEUDOHEADER" id="ERR_HTTP2_INVALID_PSEUDOHEADER">#</a></span></h3>
<p>Only valid HTTP/2 pseudoheaders (<code>:status</code>, <code>:path</code>, <code>:authority</code>, <code>:scheme</code>,
and <code>:method</code>) may be used.</p>
<p><a id="ERR_HTTP2_INVALID_SESSION"></a></p>
<h3>ERR_HTTP2_INVALID_SESSION<span><a class="mark" href="#errors_err_http2_invalid_session" id="errors_err_http2_invalid_session">#</a></span><span><a class="mark" href="#ERR_HTTP2_INVALID_SESSION" id="ERR_HTTP2_INVALID_SESSION">#</a></span></h3>
<p>An action was performed on an <code>Http2Session</code> object that had already been
destroyed.</p>
<p><a id="ERR_HTTP2_INVALID_SETTING_VALUE"></a></p>
<h3>ERR_HTTP2_INVALID_SETTING_VALUE<span><a class="mark" href="#errors_err_http2_invalid_setting_value" id="errors_err_http2_invalid_setting_value">#</a></span><span><a class="mark" href="#ERR_HTTP2_INVALID_SETTING_VALUE" id="ERR_HTTP2_INVALID_SETTING_VALUE">#</a></span></h3>
<p>An invalid value has been specified for an HTTP/2 setting.</p>
<p><a id="ERR_HTTP2_INVALID_STREAM"></a></p>
<h3>ERR_HTTP2_INVALID_STREAM<span><a class="mark" href="#errors_err_http2_invalid_stream" id="errors_err_http2_invalid_stream">#</a></span><span><a class="mark" href="#ERR_HTTP2_INVALID_STREAM" id="ERR_HTTP2_INVALID_STREAM">#</a></span></h3>
<p>An operation was performed on a stream that had already been destroyed.</p>
<p><a id="ERR_HTTP2_MAX_PENDING_SETTINGS_ACK"></a></p>
<h3>ERR_HTTP2_MAX_PENDING_SETTINGS_ACK<span><a class="mark" href="#errors_err_http2_max_pending_settings_ack" id="errors_err_http2_max_pending_settings_ack">#</a></span><span><a class="mark" href="#ERR_HTTP2_MAX_PENDING_SETTINGS_ACK" id="ERR_HTTP2_MAX_PENDING_SETTINGS_ACK">#</a></span></h3>
<p>Whenever an HTTP/2 <code>SETTINGS</code> frame is sent to a connected peer, the peer is
required to send an acknowledgement that it has received and applied the new
<code>SETTINGS</code>. By default, a maximum number of unacknowledged <code>SETTINGS</code> frames may
be sent at any given time. This error code is used when that limit has been
reached.</p>
<p><a id="ERR_HTTP2_NO_SOCKET_MANIPULATION"></a></p>
<h3>ERR_HTTP2_NO_SOCKET_MANIPULATION<span><a class="mark" href="#errors_err_http2_no_socket_manipulation" id="errors_err_http2_no_socket_manipulation">#</a></span><span><a class="mark" href="#ERR_HTTP2_NO_SOCKET_MANIPULATION" id="ERR_HTTP2_NO_SOCKET_MANIPULATION">#</a></span></h3>
<p>An attempt was made to directly manipulate (read, write, pause, resume, etc.) a
socket attached to an <code>Http2Session</code>.</p>
<p><a id="ERR_HTTP2_OUT_OF_STREAMS"></a></p>
<h3>ERR_HTTP2_OUT_OF_STREAMS<span><a class="mark" href="#errors_err_http2_out_of_streams" id="errors_err_http2_out_of_streams">#</a></span><span><a class="mark" href="#ERR_HTTP2_OUT_OF_STREAMS" id="ERR_HTTP2_OUT_OF_STREAMS">#</a></span></h3>
<p>The number of streams created on a single HTTP/2 session reached the maximum
limit.</p>
<p><a id="ERR_HTTP2_PAYLOAD_FORBIDDEN"></a></p>
<h3>ERR_HTTP2_PAYLOAD_FORBIDDEN<span><a class="mark" href="#errors_err_http2_payload_forbidden" id="errors_err_http2_payload_forbidden">#</a></span><span><a class="mark" href="#ERR_HTTP2_PAYLOAD_FORBIDDEN" id="ERR_HTTP2_PAYLOAD_FORBIDDEN">#</a></span></h3>
<p>A message payload was specified for an HTTP response code for which a payload is
forbidden.</p>
<p><a id="ERR_HTTP2_PING_CANCEL"></a></p>
<h3>ERR_HTTP2_PING_CANCEL<span><a class="mark" href="#errors_err_http2_ping_cancel" id="errors_err_http2_ping_cancel">#</a></span><span><a class="mark" href="#ERR_HTTP2_PING_CANCEL" id="ERR_HTTP2_PING_CANCEL">#</a></span></h3>
<p>An HTTP/2 ping was cancelled.</p>
<p><a id="ERR_HTTP2_PING_LENGTH"></a></p>
<h3>ERR_HTTP2_PING_LENGTH<span><a class="mark" href="#errors_err_http2_ping_length" id="errors_err_http2_ping_length">#</a></span><span><a class="mark" href="#ERR_HTTP2_PING_LENGTH" id="ERR_HTTP2_PING_LENGTH">#</a></span></h3>
<p>HTTP/2 ping payloads must be exactly 8 bytes in length.</p>
<p><a id="ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED"></a></p>
<h3>ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED<span><a class="mark" href="#errors_err_http2_pseudoheader_not_allowed" id="errors_err_http2_pseudoheader_not_allowed">#</a></span><span><a class="mark" href="#ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED" id="ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED">#</a></span></h3>
<p>An HTTP/2 pseudo-header has been used inappropriately. Pseudo-headers are header
key names that begin with the <code>:</code> prefix.</p>
<p><a id="ERR_HTTP2_PUSH_DISABLED"></a></p>
<h3>ERR_HTTP2_PUSH_DISABLED<span><a class="mark" href="#errors_err_http2_push_disabled" id="errors_err_http2_push_disabled">#</a></span><span><a class="mark" href="#ERR_HTTP2_PUSH_DISABLED" id="ERR_HTTP2_PUSH_DISABLED">#</a></span></h3>
<p>An attempt was made to create a push stream, which had been disabled by the
client.</p>
<p><a id="ERR_HTTP2_SEND_FILE"></a></p>
<h3>ERR_HTTP2_SEND_FILE<span><a class="mark" href="#errors_err_http2_send_file" id="errors_err_http2_send_file">#</a></span><span><a class="mark" href="#ERR_HTTP2_SEND_FILE" id="ERR_HTTP2_SEND_FILE">#</a></span></h3>
<p>An attempt was made to use the <code>Http2Stream.prototype.responseWithFile()</code> API to
send something other than a regular file.</p>
<p><a id="ERR_HTTP2_SOCKET_BOUND"></a></p>
<h3>ERR_HTTP2_SOCKET_BOUND<span><a class="mark" href="#errors_err_http2_socket_bound" id="errors_err_http2_socket_bound">#</a></span><span><a class="mark" href="#ERR_HTTP2_SOCKET_BOUND" id="ERR_HTTP2_SOCKET_BOUND">#</a></span></h3>
<p>An attempt was made to connect a <code>Http2Session</code> object to a <code>net.Socket</code> or
<code>tls.TLSSocket</code> that had already been bound to another <code>Http2Session</code> object.</p>
<p><a id="ERR_HTTP2_STATUS_101"></a></p>
<h3>ERR_HTTP2_STATUS_101<span><a class="mark" href="#errors_err_http2_status_101" id="errors_err_http2_status_101">#</a></span><span><a class="mark" href="#ERR_HTTP2_STATUS_101" id="ERR_HTTP2_STATUS_101">#</a></span></h3>
<p>Use of the <code>101</code> Informational status code is forbidden in HTTP/2.</p>
<p><a id="ERR_HTTP2_STATUS_INVALID"></a></p>
<h3>ERR_HTTP2_STATUS_INVALID<span><a class="mark" href="#errors_err_http2_status_invalid" id="errors_err_http2_status_invalid">#</a></span><span><a class="mark" href="#ERR_HTTP2_STATUS_INVALID" id="ERR_HTTP2_STATUS_INVALID">#</a></span></h3>
<p>An invalid HTTP status code has been specified. Status codes must be an integer
between <code>100</code> and <code>599</code> (inclusive).</p>
<p><a id="ERR_HTTP2_STREAM_CLOSED"></a></p>
<h3>ERR_HTTP2_STREAM_CLOSED<span><a class="mark" href="#errors_err_http2_stream_closed" id="errors_err_http2_stream_closed">#</a></span><span><a class="mark" href="#ERR_HTTP2_STREAM_CLOSED" id="ERR_HTTP2_STREAM_CLOSED">#</a></span></h3>
<p>An action was performed on an HTTP/2 Stream that had already been closed.</p>
<p><a id="ERR_HTTP2_STREAM_ERROR"></a></p>
<h3>ERR_HTTP2_STREAM_ERROR<span><a class="mark" href="#errors_err_http2_stream_error" id="errors_err_http2_stream_error">#</a></span><span><a class="mark" href="#ERR_HTTP2_STREAM_ERROR" id="ERR_HTTP2_STREAM_ERROR">#</a></span></h3>
<p>A non-zero error code was been specified in an <code>RST_STREAM</code> frame.</p>
<p><a id="ERR_HTTP2_STREAM_SELF_DEPENDENCY"></a></p>
<h3>ERR_HTTP2_STREAM_SELF_DEPENDENCY<span><a class="mark" href="#errors_err_http2_stream_self_dependency" id="errors_err_http2_stream_self_dependency">#</a></span><span><a class="mark" href="#ERR_HTTP2_STREAM_SELF_DEPENDENCY" id="ERR_HTTP2_STREAM_SELF_DEPENDENCY">#</a></span></h3>
<p>When setting the priority for an HTTP/2 stream, the stream may be marked as
a dependency for a parent stream. This error code is used when an attempt is
made to mark a stream and dependent of itself.</p>
<p><a id="ERR_HTTP2_UNSUPPORTED_PROTOCOL"></a></p>
<h3>ERR_HTTP2_UNSUPPORTED_PROTOCOL<span><a class="mark" href="#errors_err_http2_unsupported_protocol" id="errors_err_http2_unsupported_protocol">#</a></span><span><a class="mark" href="#ERR_HTTP2_UNSUPPORTED_PROTOCOL" id="ERR_HTTP2_UNSUPPORTED_PROTOCOL">#</a></span></h3>
<p><code>http2.connect()</code> was passed a URL that uses any protocol other than <code>http:</code> or
<code>https:</code>.</p>
<p><a id="ERR_INDEX_OUT_OF_RANGE"></a></p>
<h3>ERR_INDEX_OUT_OF_RANGE<span><a class="mark" href="#errors_err_index_out_of_range" id="errors_err_index_out_of_range">#</a></span><span><a class="mark" href="#ERR_INDEX_OUT_OF_RANGE" id="ERR_INDEX_OUT_OF_RANGE">#</a></span></h3>
<p>A given index was out of the accepted range (e.g. negative offsets).</p>
<p><a id="ERR_INVALID_ARG_TYPE"></a></p>
<h3>ERR_INVALID_ARG_TYPE<span><a class="mark" href="#errors_err_invalid_arg_type" id="errors_err_invalid_arg_type">#</a></span><span><a class="mark" href="#ERR_INVALID_ARG_TYPE" id="ERR_INVALID_ARG_TYPE">#</a></span></h3>
<p>An argument of the wrong type was passed to a Node.js API.</p>
<p><a id="ERR_INVALID_ASYNC_ID"></a></p>
<h3>ERR_INVALID_ASYNC_ID<span><a class="mark" href="#errors_err_invalid_async_id" id="errors_err_invalid_async_id">#</a></span><span><a class="mark" href="#ERR_INVALID_ASYNC_ID" id="ERR_INVALID_ASYNC_ID">#</a></span></h3>
<p>An invalid <code>asyncId</code> or <code>triggerAsyncId</code> was passed using <code>AsyncHooks</code>. An id less than -1 should never happen.</p>
<p><a id="ERR_INVALID_CALLBACK"></a></p>
<h3>ERR_INVALID_CALLBACK<span><a class="mark" href="#errors_err_invalid_callback" id="errors_err_invalid_callback">#</a></span><span><a class="mark" href="#ERR_INVALID_CALLBACK" id="ERR_INVALID_CALLBACK">#</a></span></h3>
<p>A callback function was required but was not been provided to a Node.js API.</p>
<p><a id="ERR_INVALID_FILE_URL_HOST"></a></p>
<h3>ERR_INVALID_FILE_URL_HOST<span><a class="mark" href="#errors_err_invalid_file_url_host" id="errors_err_invalid_file_url_host">#</a></span><span><a class="mark" href="#ERR_INVALID_FILE_URL_HOST" id="ERR_INVALID_FILE_URL_HOST">#</a></span></h3>
<p>A Node.js API that consumes <code>file:</code> URLs (such as certain functions in the
[<code>fs</code>][] module) encountered a file URL with an incompatible host. This
situation can only occur on Unix-like systems where only <code>localhost</code> or an empty
host is supported.</p>
<p><a id="ERR_INVALID_FILE_URL_PATH"></a></p>
<h3>ERR_INVALID_FILE_URL_PATH<span><a class="mark" href="#errors_err_invalid_file_url_path" id="errors_err_invalid_file_url_path">#</a></span><span><a class="mark" href="#ERR_INVALID_FILE_URL_PATH" id="ERR_INVALID_FILE_URL_PATH">#</a></span></h3>
<p>A Node.js API that consumes <code>file:</code> URLs (such as certain functions in the
[<code>fs</code>][] module) encountered a file URL with an incompatible path. The exact
semantics for determining whether a path can be used is platform-dependent.</p>
<p><a id="ERR_INVALID_HANDLE_TYPE"></a></p>
<h3>ERR_INVALID_HANDLE_TYPE<span><a class="mark" href="#errors_err_invalid_handle_type" id="errors_err_invalid_handle_type">#</a></span><span><a class="mark" href="#ERR_INVALID_HANDLE_TYPE" id="ERR_INVALID_HANDLE_TYPE">#</a></span></h3>
<p>An attempt was made to send an unsupported &quot;handle&quot; over an IPC communication
channel to a child process. See [<code>subprocess.send()</code>] and [<code>process.send()</code>] for
more information.</p>
<p><a id="ERR_INVALID_OPT_VALUE"></a></p>
<h3>ERR_INVALID_OPT_VALUE<span><a class="mark" href="#errors_err_invalid_opt_value" id="errors_err_invalid_opt_value">#</a></span><span><a class="mark" href="#ERR_INVALID_OPT_VALUE" id="ERR_INVALID_OPT_VALUE">#</a></span></h3>
<p>An invalid or unexpected value was passed in an options object.</p>
<p><a id="ERR_INVALID_PERFORMANCE_MARK"></a></p>
<h3>ERR_INVALID_PERFORMANCE_MARK<span><a class="mark" href="#errors_err_invalid_performance_mark" id="errors_err_invalid_performance_mark">#</a></span><span><a class="mark" href="#ERR_INVALID_PERFORMANCE_MARK" id="ERR_INVALID_PERFORMANCE_MARK">#</a></span></h3>
<p>While using the Performance Timing API (<code>perf_hooks</code>), a performance mark is invalid.</p>
<p><a id="ERR_INVALID_PROTOCOL"></a></p>
<h3>ERR_INVALID_PROTOCOL<span><a class="mark" href="#errors_err_invalid_protocol" id="errors_err_invalid_protocol">#</a></span><span><a class="mark" href="#ERR_INVALID_PROTOCOL" id="ERR_INVALID_PROTOCOL">#</a></span></h3>
<p>An invalid <code>options.protocol</code> was passed.</p>
<p><a id="ERR_INVALID_SYNC_FORK_INPUT"></a></p>
<h3>ERR_INVALID_SYNC_FORK_INPUT<span><a class="mark" href="#errors_err_invalid_sync_fork_input" id="errors_err_invalid_sync_fork_input">#</a></span><span><a class="mark" href="#ERR_INVALID_SYNC_FORK_INPUT" id="ERR_INVALID_SYNC_FORK_INPUT">#</a></span></h3>
<p>A <code>Buffer</code>, <code>Uint8Array</code> or <code>string</code> was provided as stdio input to a
synchronous fork. See the documentation for the
<a href="child_process.html"><code>child_process</code></a> module for more information.</p>
<p><a id="ERR_INVALID_THIS"></a></p>
<h3>ERR_INVALID_THIS<span><a class="mark" href="#errors_err_invalid_this" id="errors_err_invalid_this">#</a></span><span><a class="mark" href="#ERR_INVALID_THIS" id="ERR_INVALID_THIS">#</a></span></h3>
<p>A Node.js API function was called with an incompatible <code>this</code> value.</p>
<p>Example:</p>
<pre><code class="lang-js">const { URLSearchParams } = require(&apos;url&apos;);
const urlSearchParams = new URLSearchParams(&apos;foo=bar&amp;baz=new&apos;);

const buf = Buffer.alloc(1);
urlSearchParams.has.call(buf, &apos;foo&apos;);
// Throws a TypeError with code &apos;ERR_INVALID_THIS&apos;
</code></pre>
<p><a id="ERR_INVALID_TUPLE"></a></p>
<h3>ERR_INVALID_TUPLE<span><a class="mark" href="#errors_err_invalid_tuple" id="errors_err_invalid_tuple">#</a></span><span><a class="mark" href="#ERR_INVALID_TUPLE" id="ERR_INVALID_TUPLE">#</a></span></h3>
<p>An element in the <code>iterable</code> provided to the [WHATWG][WHATWG URL API]
[<code>URLSearchParams</code> constructor][<code>new URLSearchParams(iterable)</code>] did not
represent a <code>[name, value]</code> tuple – that is, if an element is not iterable, or
does not consist of exactly two elements.</p>
<p><a id="ERR_INVALID_URL"></a></p>
<h3>ERR_INVALID_URL<span><a class="mark" href="#errors_err_invalid_url" id="errors_err_invalid_url">#</a></span><span><a class="mark" href="#ERR_INVALID_URL" id="ERR_INVALID_URL">#</a></span></h3>
<p>An invalid URL was passed to the [WHATWG][WHATWG URL API]
[<code>URL</code> constructor][<code>new URL(input)</code>] to be parsed. The thrown error object
typically has an additional property <code>&apos;input&apos;</code> that contains the URL that failed
to parse.</p>
<p><a id="ERR_INVALID_URL_SCHEME"></a></p>
<h3>ERR_INVALID_URL_SCHEME<span><a class="mark" href="#errors_err_invalid_url_scheme" id="errors_err_invalid_url_scheme">#</a></span><span><a class="mark" href="#ERR_INVALID_URL_SCHEME" id="ERR_INVALID_URL_SCHEME">#</a></span></h3>
<p>An attempt was made to use a URL of an incompatible scheme (protocol) for a
specific purpose. It is only used in the [WHATWG URL API][] support in the
[<code>fs</code>][] module (which only accepts URLs with <code>&apos;file&apos;</code> scheme), but may be used
in other Node.js APIs as well in the future.</p>
<p><a id="ERR_IPC_CHANNEL_CLOSED"></a></p>
<h3>ERR_IPC_CHANNEL_CLOSED<span><a class="mark" href="#errors_err_ipc_channel_closed" id="errors_err_ipc_channel_closed">#</a></span><span><a class="mark" href="#ERR_IPC_CHANNEL_CLOSED" id="ERR_IPC_CHANNEL_CLOSED">#</a></span></h3>
<p>An attempt was made to use an IPC communication channel that was already closed.</p>
<p><a id="ERR_IPC_DISCONNECTED"></a></p>
<h3>ERR_IPC_DISCONNECTED<span><a class="mark" href="#errors_err_ipc_disconnected" id="errors_err_ipc_disconnected">#</a></span><span><a class="mark" href="#ERR_IPC_DISCONNECTED" id="ERR_IPC_DISCONNECTED">#</a></span></h3>
<p>An attempt was made to disconnect an IPC communication channel that was already
disconnected. See the documentation for the
<a href="child_process.html"><code>child_process</code></a> module for more information.</p>
<p><a id="ERR_IPC_ONE_PIPE"></a></p>
<h3>ERR_IPC_ONE_PIPE<span><a class="mark" href="#errors_err_ipc_one_pipe" id="errors_err_ipc_one_pipe">#</a></span><span><a class="mark" href="#ERR_IPC_ONE_PIPE" id="ERR_IPC_ONE_PIPE">#</a></span></h3>
<p>An attempt was made to create a child Node.js process using more than one IPC
communication channel. See the documentation for the
<a href="child_process.html"><code>child_process</code></a> module for more information.</p>
<p><a id="ERR_IPC_SYNC_FORK"></a></p>
<h3>ERR_IPC_SYNC_FORK<span><a class="mark" href="#errors_err_ipc_sync_fork" id="errors_err_ipc_sync_fork">#</a></span><span><a class="mark" href="#ERR_IPC_SYNC_FORK" id="ERR_IPC_SYNC_FORK">#</a></span></h3>
<p>An attempt was made to open an IPC communication channel with a synchronously
forked Node.js process. See the documentation for the
<a href="child_process.html"><code>child_process</code></a> module for more information.</p>
<p><a id="ERR_MISSING_ARGS"></a></p>
<h3>ERR_MISSING_ARGS<span><a class="mark" href="#errors_err_missing_args" id="errors_err_missing_args">#</a></span><span><a class="mark" href="#ERR_MISSING_ARGS" id="ERR_MISSING_ARGS">#</a></span></h3>
<p>A required argument of a Node.js API was not passed. This is only used for
strict compliance with the API specification (which in some cases may accept
<code>func(undefined)</code> but not <code>func()</code>). In most native Node.js APIs,
<code>func(undefined)</code> and <code>func()</code> are treated identically, and the
[<code>ERR_INVALID_ARG_TYPE</code>][] error code may be used instead.</p>
<p><a id="ERR_NAPI_CONS_FUNCTION"></a></p>
<h3>ERR_NAPI_CONS_FUNCTION<span><a class="mark" href="#errors_err_napi_cons_function" id="errors_err_napi_cons_function">#</a></span><span><a class="mark" href="#ERR_NAPI_CONS_FUNCTION" id="ERR_NAPI_CONS_FUNCTION">#</a></span></h3>
<p>While using <code>N-API</code>, a constructor passed was not a function.</p>
<p><a id="ERR_NAPI_CONS_PROTOTYPE_OBJECT"></a></p>
<h3>ERR_NAPI_CONS_PROTOTYPE_OBJECT<span><a class="mark" href="#errors_err_napi_cons_prototype_object" id="errors_err_napi_cons_prototype_object">#</a></span><span><a class="mark" href="#ERR_NAPI_CONS_PROTOTYPE_OBJECT" id="ERR_NAPI_CONS_PROTOTYPE_OBJECT">#</a></span></h3>
<p>While using <code>N-API</code>, <code>Constructor.prototype</code> was not an object.</p>
<p><a id="ERR_NO_ICU"></a></p>
<h3>ERR_NO_ICU<span><a class="mark" href="#errors_err_no_icu" id="errors_err_no_icu">#</a></span><span><a class="mark" href="#ERR_NO_ICU" id="ERR_NO_ICU">#</a></span></h3>
<p>An attempt was made to use features that require [ICU][], but Node.js was not compiled with ICU support.</p>
<p><a id="ERR_OUTOFMEMORY"></a></p>
<h3>ERR_OUTOFMEMORY<span><a class="mark" href="#errors_err_outofmemory" id="errors_err_outofmemory">#</a></span><span><a class="mark" href="#ERR_OUTOFMEMORY" id="ERR_OUTOFMEMORY">#</a></span></h3>
<p>An operation caused an out-of-memory condition.</p>
<p><a id="ERR_SOCKET_ALREADY_BOUND"></a></p>
<h3>ERR_SOCKET_ALREADY_BOUND<span><a class="mark" href="#errors_err_socket_already_bound" id="errors_err_socket_already_bound">#</a></span><span><a class="mark" href="#ERR_SOCKET_ALREADY_BOUND" id="ERR_SOCKET_ALREADY_BOUND">#</a></span></h3>
<p>An attempt was made to bind a socket that has already been bound.</p>
<p><a id="ERR_SOCKET_BAD_PORT"></a></p>
<h3>ERR_SOCKET_BAD_PORT<span><a class="mark" href="#errors_err_socket_bad_port" id="errors_err_socket_bad_port">#</a></span><span><a class="mark" href="#ERR_SOCKET_BAD_PORT" id="ERR_SOCKET_BAD_PORT">#</a></span></h3>
<p>An API function expecting a port &gt; 0 and &lt; 65536 received an invalid value.</p>
<p><a id="ERR_SOCKET_BAD_TYPE"></a></p>
<h3>ERR_SOCKET_BAD_TYPE<span><a class="mark" href="#errors_err_socket_bad_type" id="errors_err_socket_bad_type">#</a></span><span><a class="mark" href="#ERR_SOCKET_BAD_TYPE" id="ERR_SOCKET_BAD_TYPE">#</a></span></h3>
<p>An API function expecting a socket type (<code>udp4</code> or <code>udp6</code>) received an invalid value.</p>
<p><a id="ERR_SOCKET_CANNOT_SEND"></a></p>
<h3>ERR_SOCKET_CANNOT_SEND<span><a class="mark" href="#errors_err_socket_cannot_send" id="errors_err_socket_cannot_send">#</a></span><span><a class="mark" href="#ERR_SOCKET_CANNOT_SEND" id="ERR_SOCKET_CANNOT_SEND">#</a></span></h3>
<p>Data could be sent on a socket.</p>
<p><a id="ERR_SOCKET_CLOSED"></a></p>
<h3>ERR_SOCKET_CLOSED<span><a class="mark" href="#errors_err_socket_closed" id="errors_err_socket_closed">#</a></span><span><a class="mark" href="#ERR_SOCKET_CLOSED" id="ERR_SOCKET_CLOSED">#</a></span></h3>
<p>An attempt was made to operate on an already closed socket.</p>
<p><a id="ERR_SOCKET_DGRAM_NOT_RUNNING"></a></p>
<h3>ERR_SOCKET_DGRAM_NOT_RUNNING<span><a class="mark" href="#errors_err_socket_dgram_not_running" id="errors_err_socket_dgram_not_running">#</a></span><span><a class="mark" href="#ERR_SOCKET_DGRAM_NOT_RUNNING" id="ERR_SOCKET_DGRAM_NOT_RUNNING">#</a></span></h3>
<p>A call was made and the UDP subsystem was not running.</p>
<p><a id="ERR_STDERR_CLOSE"></a></p>
<h3>ERR_STDERR_CLOSE<span><a class="mark" href="#errors_err_stderr_close" id="errors_err_stderr_close">#</a></span><span><a class="mark" href="#ERR_STDERR_CLOSE" id="ERR_STDERR_CLOSE">#</a></span></h3>
<p>An attempt was made to close the <code>process.stderr</code> stream. By design, Node.js
does not allow <code>stdout</code> or <code>stderr</code> streams to be closed by user code.</p>
<p><a id="ERR_STDOUT_CLOSE"></a></p>
<h3>ERR_STDOUT_CLOSE<span><a class="mark" href="#errors_err_stdout_close" id="errors_err_stdout_close">#</a></span><span><a class="mark" href="#ERR_STDOUT_CLOSE" id="ERR_STDOUT_CLOSE">#</a></span></h3>
<p>An attempt was made to close the <code>process.stdout</code> stream. By design, Node.js
does not allow <code>stdout</code> or <code>stderr</code> streams to be closed by user code.</p>
<p><a id="ERR_TLS_CERT_ALTNAME_INVALID"></a></p>
<h3>ERR_TLS_CERT_ALTNAME_INVALID<span><a class="mark" href="#errors_err_tls_cert_altname_invalid" id="errors_err_tls_cert_altname_invalid">#</a></span><span><a class="mark" href="#ERR_TLS_CERT_ALTNAME_INVALID" id="ERR_TLS_CERT_ALTNAME_INVALID">#</a></span></h3>
<p>While using TLS, the hostname/IP of the peer did not match any of the
subjectAltNames in its certificate.</p>
<p><a id="ERR_TLS_DH_PARAM_SIZE"></a></p>
<h3>ERR_TLS_DH_PARAM_SIZE<span><a class="mark" href="#errors_err_tls_dh_param_size" id="errors_err_tls_dh_param_size">#</a></span><span><a class="mark" href="#ERR_TLS_DH_PARAM_SIZE" id="ERR_TLS_DH_PARAM_SIZE">#</a></span></h3>
<p>While using TLS, the parameter offered for the Diffie-Hellman (<code>DH</code>)
key-agreement protocol is too small. By default, the key length must be greater
than or equal to 1024 bits to avoid vulnerabilities, even though it is strongly
recommended to use 2048 bits or larger for stronger security.</p>
<p><a id="ERR_TLS_HANDSHAKE_TIMEOUT"></a></p>
<h3>ERR_TLS_HANDSHAKE_TIMEOUT<span><a class="mark" href="#errors_err_tls_handshake_timeout" id="errors_err_tls_handshake_timeout">#</a></span><span><a class="mark" href="#ERR_TLS_HANDSHAKE_TIMEOUT" id="ERR_TLS_HANDSHAKE_TIMEOUT">#</a></span></h3>
<p>A TLS/SSL handshake timed out. In this case, the server must also abort the connection.</p>
<p><a id="ERR_TLS_RENEGOTIATION_FAILED"></a></p>
<h3>ERR_TLS_RENEGOTIATION_FAILED<span><a class="mark" href="#errors_err_tls_renegotiation_failed" id="errors_err_tls_renegotiation_failed">#</a></span><span><a class="mark" href="#ERR_TLS_RENEGOTIATION_FAILED" id="ERR_TLS_RENEGOTIATION_FAILED">#</a></span></h3>
<p>A TLS renegotiation request has failed in a non-specific way.</p>
<p><a id="ERR_TLS_REQUIRED_SERVER_NAME"></a></p>
<h3>ERR_TLS_REQUIRED_SERVER_NAME<span><a class="mark" href="#errors_err_tls_required_server_name" id="errors_err_tls_required_server_name">#</a></span><span><a class="mark" href="#ERR_TLS_REQUIRED_SERVER_NAME" id="ERR_TLS_REQUIRED_SERVER_NAME">#</a></span></h3>
<p>While using TLS, the <code>server.addContext()</code> method was called without providing
a hostname in the first parameter.</p>
<p><a id="ERR_TLS_SESSION_ATTACK"></a></p>
<h3>ERR_TLS_SESSION_ATTACK<span><a class="mark" href="#errors_err_tls_session_attack" id="errors_err_tls_session_attack">#</a></span><span><a class="mark" href="#ERR_TLS_SESSION_ATTACK" id="ERR_TLS_SESSION_ATTACK">#</a></span></h3>
<p>An excessive amount of TLS renegotiations is detected, which is a potential vector for denial-of-service attacks.</p>
<p><a id="ERR_TRANSFORM_ALREADY_TRANSFORMING"></a></p>
<h3>ERR_TRANSFORM_ALREADY_TRANSFORMING<span><a class="mark" href="#errors_err_transform_already_transforming" id="errors_err_transform_already_transforming">#</a></span><span><a class="mark" href="#ERR_TRANSFORM_ALREADY_TRANSFORMING" id="ERR_TRANSFORM_ALREADY_TRANSFORMING">#</a></span></h3>
<p>A Transform stream finished while it was still transforming.</p>
<p><a id="ERR_TRANSFORM_WITH_LENGTH_0"></a></p>
<h3>ERR_TRANSFORM_WITH_LENGTH_0<span><a class="mark" href="#errors_err_transform_with_length_0" id="errors_err_transform_with_length_0">#</a></span><span><a class="mark" href="#ERR_TRANSFORM_WITH_LENGTH_0" id="ERR_TRANSFORM_WITH_LENGTH_0">#</a></span></h3>
<p>A Transform stream finished with data still in the write buffer.</p>
<p><a id="ERR_UNKNOWN_SIGNAL"></a></p>
<h3>ERR_UNKNOWN_SIGNAL<span><a class="mark" href="#errors_err_unknown_signal" id="errors_err_unknown_signal">#</a></span><span><a class="mark" href="#ERR_UNKNOWN_SIGNAL" id="ERR_UNKNOWN_SIGNAL">#</a></span></h3>
<p>An invalid or unknown process signal was passed to an API expecting a valid signal (such as [<code>subprocess.kill()</code>][]).</p>
<p><a id="ERR_UNKNOWN_STDIN_TYPE"></a></p>
<h3>ERR_UNKNOWN_STDIN_TYPE<span><a class="mark" href="#errors_err_unknown_stdin_type" id="errors_err_unknown_stdin_type">#</a></span><span><a class="mark" href="#ERR_UNKNOWN_STDIN_TYPE" id="ERR_UNKNOWN_STDIN_TYPE">#</a></span></h3>
<p>An attempt was made to launch a Node.js process with an unknown <code>stdin</code> file
type. This error is usually an indication of a bug within Node.js itself,
although it is possible for user code to trigger it.</p>
<p><a id="ERR_UNKNOWN_STREAM_TYPE"></a></p>
<h3>ERR_UNKNOWN_STREAM_TYPE<span><a class="mark" href="#errors_err_unknown_stream_type" id="errors_err_unknown_stream_type">#</a></span><span><a class="mark" href="#ERR_UNKNOWN_STREAM_TYPE" id="ERR_UNKNOWN_STREAM_TYPE">#</a></span></h3>
<p>An attempt was made to launch a Node.js process with an unknown <code>stdout</code> or
<code>stderr</code> file type. This error is usually an indication of a bug within Node.js
itself, although it is possible for user code to trigger it.</p>
<p><a id="ERR_V8BREAKITERATOR"></a></p>
<h3>ERR_V8BREAKITERATOR<span><a class="mark" href="#errors_err_v8breakiterator" id="errors_err_v8breakiterator">#</a></span><span><a class="mark" href="#ERR_V8BREAKITERATOR" id="ERR_V8BREAKITERATOR">#</a></span></h3>
<p>The V8 BreakIterator API was used but the full ICU data set is not installed.</p>
<p><a id="ERR_VALID_PERFORMANCE_ENTRY_TYPE"></a></p>
<h3>ERR_VALID_PERFORMANCE_ENTRY_TYPE<span><a class="mark" href="#errors_err_valid_performance_entry_type" id="errors_err_valid_performance_entry_type">#</a></span><span><a class="mark" href="#ERR_VALID_PERFORMANCE_ENTRY_TYPE" id="ERR_VALID_PERFORMANCE_ENTRY_TYPE">#</a></span></h3>
<p>While using the Performance Timing API (<code>perf_hooks</code>), no valid performance
entry types were found.</p>
<p><a id="ERR_VALUE_OUT_OF_RANGE"></a></p>
<h3>ERR_VALUE_OUT_OF_RANGE<span><a class="mark" href="#errors_err_value_out_of_range" id="errors_err_value_out_of_range">#</a></span><span><a class="mark" href="#ERR_VALUE_OUT_OF_RANGE" id="ERR_VALUE_OUT_OF_RANGE">#</a></span></h3>
<p>A given value is out of the accepted range.
[<code>ERR_INVALID_ARG_TYPE</code>]: #ERR_INVALID_ARG_TYPE
[<code>subprocess.kill()</code>]: child_process.html#child_process_subprocess_kill_signal
[<code>subprocess.send()</code>]: child_process.html#child_process_subprocess_send_message_sendhandle_options_callback
[<code>fs.readFileSync</code>]: fs.html#fs_fs_readfilesync_path_options
[<code>fs.readdir</code>]: fs.html#fs_fs_readdir_path_options_callback
[<code>fs.unlink</code>]: fs.html#fs_fs_unlink_path_callback
[<code>fs</code>]: fs.html
[<code>http</code>]: http.html
[<code>https</code>]: https.html
[<code>libuv Error handling</code>]: <a href="http://docs.libuv.org/en/v1.x/errors.html">http://docs.libuv.org/en/v1.x/errors.html</a>
[<code>net</code>]: net.html
[<code>new URL(input)</code>]: url.html#url_constructor_new_url_input_base
[<code>new URLSearchParams(iterable)</code>]: url.html#url_constructor_new_urlsearchparams_iterable
[<code>process.on(&apos;uncaughtException&apos;)</code>]: process.html#process_event_uncaughtexception
[<code>process.send()</code>]: process.html#process_process_send_message_sendhandle_options_callback
[ICU]: intl.html#intl_internationalization_support
[Node.js Error Codes]: #nodejs-error-codes
[V8&apos;s stack trace API]: <a href="https://github.com/v8/v8/wiki/Stack-Trace-API">https://github.com/v8/v8/wiki/Stack-Trace-API</a>
[WHATWG URL API]: url.html#url_the_whatwg_url_api
[domains]: domain.html
[event emitter-based]: events.html#events_class_eventemitter
[file descriptors]: <a href="https://en.wikipedia.org/wiki/File_descriptor">https://en.wikipedia.org/wiki/File_descriptor</a>
[online]: <a href="http://man7.org/linux/man-pages/man3/errno.3.html">http://man7.org/linux/man-pages/man3/errno.3.html</a>
[stream-based]: stream.html
[syscall]: <a href="http://man7.org/linux/man-pages/man2/syscall.2.html">http://man7.org/linux/man-pages/man2/syscall.2.html</a>
[try-catch]: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch</a>
[vm]: vm.html
[WHATWG Supported Encodings]: util.md#whatwg-supported-encodings</p>

      </div>
    </div>

    <div id="column2" class="interior">
      <div id="intro" class="interior">
        <a href="/" title="Go back to the home page">
          Node.js 中文文档 | Node.js 中文网
        </a>
      </div>
      
        <!-- [start-include:_toc.md] -->
<ul>
<li><a href="documentation.html">关于本文档</a></li>
<li><a href="synopsis.html">用法与例子</a></li>
</ul>
<div class="line"></div>

<ul>
<li><a href="assert.html">断言测试</a></li>
<li><a href="async_hooks.html">异步钩子（Async Hooks）</a></li>
<li><a href="buffer.html">缓存（Buffer）</a></li>
<li><a href="addons.html">C++ 插件</a></li>
<li><a href="n-api.html">C/C++ 插件 - N-API</a></li>
<li><a href="child_process.html">子进程</a></li>
<li><a href="cluster.html">集群（Cluster）</a></li>
<li><a href="cli.html">命令行参数</a></li>
<li><a href="console.html">控制台（Console）</a></li>
<li><a href="crypto.html">加密（Crypto）</a></li>
<li><a href="debugger.html">调试器</a></li>
<li><a href="deprecations.html">废弃的 API</a></li>
<li><a href="dns.html">DNS</a></li>
<li><a href="domain.html">域（Domain）</a></li>
<li><a href="esm.html">ECMAScript 模块</a></li>
<li><a href="errors.html">错误（Errors）</a></li>
<li><a href="events.html">事件（Events）</a></li>
<li><a href="fs.html">文件系统</a></li>
<li><a href="globals.html">全局对象（Globals）</a></li>
<li><a href="http.html">HTTP</a></li>
<li><a href="http2.html">HTTP/2</a></li>
<li><a href="https.html">HTTPS</a></li>
<li><a href="inspector.html">检查工具（Inspector）</a></li>
<li><a href="intl.html">国际化</a></li>
<li><a href="modules.html">模块（Modules）</a></li>
<li><a href="net.html">网络（Net）</a></li>
<li><a href="os.html">操作系统（OS）</a></li>
<li><a href="path.html">路径（Path）</a></li>
<li><a href="perf_hooks.html">性能钩子（Performance Hooks）</a></li>
<li><a href="process.html">进程</a></li>
<li><a href="punycode.html">Punycode</a></li>
<li><a href="querystring.html">查询字符串</a></li>
<li><a href="readline.html">逐行读取</a></li>
<li><a href="repl.html">交互式解释器（REPL）</a></li>
<li><a href="stream.html">流（Stream）</a></li>
<li><a href="string_decoder.html">字符串解码</a></li>
<li><a href="timers.html">定时器（Timers）</a></li>
<li><a href="tls.html">安全传输层（TLS/SSL）</a></li>
<li><a href="tracing.html">事件跟踪（Tracing）</a></li>
<li><a href="tty.html">TTY</a></li>
<li><a href="dgram.html">UDP / 数据报</a></li>
<li><a href="url.html">URL</a></li>
<li><a href="util.html">工具集</a></li>
<li><a href="v8.html">V8</a></li>
<li><a href="vm.html">虚拟机（VM）</a></li>
<li><a href="zlib.html">压缩（ZLIB）</a></li>
</ul>
<div class="line"></div>

<ul>
<li><a href="https://github.com/nodejs/node">GitHub 仓库和问题跟踪</a></li>
<li><a href="https://groups.google.com/group/nodejs">邮件列表</a></li>
</ul>
<!-- [end-include:_toc.md] -->

      
    </div>
  </div>
  <script src="assets/sh_main.js"></script>
  <script src="assets/sh_javascript.min.js"></script>
  <script>highlight(undefined, undefined, 'pre');</script>
</body>
</html>
